<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function isYear(year) {
        // 判断是否为闰年
        if ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0) {
          return true;
        } else {
          return false;
        }
      }

      console.log(isYear(2020)); // 输出: true
      console.log(isYear(1900)); // 输出: false
      console.log(isYear(2000)); // 输出: true
    </script>
  </body>
</html>
